﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Companies_Customers : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void dvCustomers_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
        RefreshGridViewCustomers();
    }
    protected void dvCustomers_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {
        RefreshGridViewCustomers();
    }

    private void RefreshGridViewCustomers()
    {
        gvCustomers.DataBind();
    }
    protected void dvCustomers_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
    {
        RefreshGridViewCustomers();
    }
    protected void gvCustomers_SelectedIndexChanged(object sender, EventArgs e)
    {
        dvCustomers.ChangeMode(DetailsViewMode.ReadOnly);
    }
    protected void btnNewCustomer_Click(object sender, EventArgs e)
    {
        dvCustomers.ChangeMode(DetailsViewMode.Insert);
    }

    protected void dvCustomers_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
    {
    }
    protected void LinkButton1_Click2(object sender, EventArgs e)
    {
        string customerID = "CustProducts.aspx?CustomerID=" + gvCustomers.SelectedDataKey.Value.ToString();
        Response.Redirect(customerID);
    }
}
